<?php
include 'common.php';
$agencyArr = array(
    'BWC' => '08',
    'MOL' => '27',
    'FOR' => '03',
    'QDC' => '09',
    'CCL' => '38',
    'PSL' => '88',
    'DLC' => '21',
    'IPL' => '33',
    'YJT' => '52',
    'SAS' => '55',
    'ABC' => '11',
    'MGY' => '16',
    'KNI' => '18',
    'BSH' => '77',
    'ECG' => '10',
    'HFI' => '98',
    'SAC' => '97',
    'XXX' => '99'
);

$agencyFlipArr = array_flip($agencyArr);

$csv = 'id_pass.csv';
$csvData = csv2arr($csv);
// debug($csvData);
foreach ($csvData as $key => $row) {
    $agencyID = substr($row['ID'], 0, 3);
    if (isset($agencyArr[$agencyID])) {
        $csvData[$key]['ID'] = '0' . $agencyArr[$agencyID] . substr($row['ID'], 3);
    }
}
debugdie(array_to_csv($csvData));